<!DOCTYPE html>
<html>
	<head>
		<meta charset="UTF-8">
		<meta name="viewport" content="initial-scale=1.0, maximum-scale=1.0, user-scalable=no" />
		<title></title>	
	</head>
	<link rel="stylesheet" type="text/css" href="http://at.alicdn.com/t/font_438362_4n31cgyrysfnipb9.css"/>
	<link rel="stylesheet" type="text/css" href="css/base.css"/>
	<style type="text/css">
		*{
			margin: 0;
			padding: 0 ;
		}
		.warp{
			width: 100%;
			height: 7.5rem;		
			position: relative;
		}
		.icon-shouye{
			position: absolute;
			left: 5%;
			top: 0.2rem;
			font-size: 0.4rem;
		}
		.logo{
			position: absolute;
			left: 50%;
			top: 1.02rem;
			margin-left: -1rem;
		}
		.logo img{
			width: 1.96rem;
			height: 0.58rem;
		}
		.money_img{
			width: 1.75rem;
			height: 1.75rem;
			background: #fff;
			border-radius: 50%;
			position: absolute;
			top: 2.07rem;
			left: 50%;
			margin-left: -0.9rem;
		}
		.money_img img{
			width: 1.23rem;
			height: 0.8rem;
			position: absolute;
			left: 50%;
			height: 50%;
			margin-left: -0.61rem;
			margin-top: 0.4rem;
			box-shadow: 0.02rem 0.02rem 0.03rem #e60012;
		}
		.title{
			width: 100%;
			height: 2rem;
			margin: 0 auto;
			position: absolute;
			left: 0;
			top: 4.2rem;
		}
		.title img{
			width: 4.2rem;
			height: 0.44rem;
			margin-left: 15%;
		}
		.title p{
			text-align: center;
			color: #000;
			font-size: 0.26rem;
			margin: 0.16rem 0 0.4rem 0;
		}
		.title h3{
			font-size: 0.7rem;
			text-align: center;
			font-weight: normal;
			
		}
		.bg_img{
			position: absolute;
			top: 6.6rem;
		}
		.bg_img img{
			width: 100%;
			height: 2.1rem;
		}
		.footer{
			width: 90%;
			height: auto;
			
			line-height: 0.4rem;
			margin:1.3rem 5% 0 5%;
			font-size: 0.2rem;
		}
		.footer .first_p{
			color: #fc5151;
			background: #F6F6F6;
		}
	</style>
	<body>
		<div class="warp">
			<i class="iconfont icon-shouye"></i>
			<div class="logo">
				<img src="img/logo.png"/>
			</div>	
			<div class="money_img">
				<img src="img/hongbao.png"/>
			</div>
			<div class="title">
				<h3></h3>
				<p>每邀请一位新好友，您将获取40元</p>
			</div>	
			<div class="bg_img">
				<img src="img/img.png"/>
			</div>
		</div>
		<div class="footer">
					
		</div>
	</body>
	<script src="js/jquery-3.1.1.min.js" type="text/javascript" charset="utf-8"></script>
	<script type="text/javascript" src="http://res.wx.qq.com/open/js/jweixin-1.2.0.js"></script>
	<script type="text/javascript">
		$.ajax({
			type:"get",
			url:"http://bbs.tl178.cn/sha_Set",
			async:true,
			success:function(data){
			  var data = JSON.parse(data)
				$(".title h3").html(data["list"]["s_title"])
				$(".footer").html(data["list"]["content"])
				$(".title p").html(data["list"]["s_explain"])
			}
		});
		function GetQueryString(name){
		     var reg = new RegExp("(^|&)"+ name +"=([^&]*)(&|$)");
		     var r = window.location.search.substr(1).match(reg);
		     if(r!=null)return  unescape(r[2]); return null;
		}
		var code = GetQueryString("code")
		var fic = GetQueryString("fic")
		var state = GetQueryString("state")
		var time = GetQueryString("time")
		//微信分享	
		$.ajax({
			type: 'post',
			url: 'http://web.tl178.cn/Share/share_s',
			headers: {
				'Content-Type': 'application/x-www-form-urlencoded'
			},
			data: {
				url: window.location.href
			},
			success: function(result){
				var result = JSON.parse(result)
				console.log(result)
				var appid = result.appId;
				var timestamp = result.timestamp;
				var nonceStr = result.nonceStr;
				var signature = result.signature;
				var title = "Hi,友人，送你40元天乐劵,去体验一种新的生活方式"
				var urlAfter = "http://app.tl178.cn/weixinshare/share.html?a=" + a + "&c=" + c + "&d=" + d + "&code=" + code + "&fic=" + fic + "&state=" + state + "&time=" + Date.parse(new Date()) + ""
				var imgUrl = "http://web.tl178.cn/Public/admin/slideshow/15032811371503281137.jpg"
				var desc = "我出去玩，体验生活一直在天乐平台,每次出行既能让让你体验生活，还能改变现状的你！首次注册成功，再送10元"
				wx.config({
					debug: false, //开启调试模式,调用的所有api的返回值会在客户端alert出来
					appId: appid, // 必填，公众号的唯一标识
					timestamp: timestamp, // 必填，生成签名的时间戳
					nonceStr: nonceStr, // 必填，生成签名的随机串
					signature: signature, // 必填，签名
					jsApiList: [
						'onMenuShareTimeline', //分享到朋友圈
						'onMenuShareAppMessage', //分享给朋友
						'onMenuShareQQ', //分享给QQ好友
						'showOptionMenu'
					]
				});
				wx.ready(function() {
					wx.showOptionMenu();
					wx.onMenuShareTimeline({ //分享到朋友圈
						title: title,
						desc: desc, // 分享标题							
						link: urlAfter, // 分享链接
						imgUrl: imgUrl, // 分享图片
						success: function() {
							$.ajax({
								type: "post",
								url: "http://bbs.tl178.cn/succ_sha",
								async: true,
								data: {
									user_Id:1,
										code:code,										
										type:3,
										state:state,
										fic:fic
								},
								success: function(data) {
									console.log(data)
								}
							});
						},
						cancel: function() {
							// 用户取消分享后执行的回调函数
						}
					});

					wx.onMenuShareAppMessage({ //分享到微信朋友
						title: title, // 分享标题
						desc: desc, // 分享描述
						link: urlAfter, // 分享链接
						imgUrl: imgUrl, // 分享图片
						type: '', // 分享类型,music、video或link，不填默认为link
						dataUrl: '', // 如果type是music或video，则要提供数据链接，默认为空
						success: function() {
							$.ajax({
								type: "post",
								url: "http://bbs.tl178.cn/succ_sha",
								async: true,
								data: {
									user_Id:1,
										code:code,
										type:2,
										state:state,
										fic:fic
								},
								success: function(data) {
									console.log(data)
								}
							});
							// 用户确认分享后执行的回调函数
						},
						cancel: function() {
							// 用户取消分享后执行的回调函数
						}
					});

					wx.onMenuShareQQ({
						title: title, // 分享标题
						desc: desc, // 分享描述
						link: urlAfter, // 分享链接
						imgUrl: imgUrl, // 分享图标
						success: function(res) {
							$.ajax({
								type: "post",
								url: "http://bbs.tl178.cn/succ_sha",
								async: true,
								data: {
									code:code,
									type:1,
									state:state,
									fic:fic
								},
								success: function(data) {
									console.log(data)
								}
							});
							// 用户确认分享后执行的回调函数
						},
						cancel: function(res) {
							// 用户取消分享后执行的回调函数
						}
					});
				});
				wx.error(function(res) {
					console.log(res)
				});
			}
		})
		
		
	</script>
</html>
